


//
//  DEFINE.h
//  nncloud
//
//  Created by macfai on 2018/9/17.
//  Copyright © 2018年 youedata. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#ifndef DEFINE_h
#define DEFINE_h

//编写留言
typedef NS_ENUM(NSInteger, kCommitType) {
    kCommitWriteMsg = 0,  //编写留言
    kCommitAutoReply,     // 自行答复
};

//创新创业相关公用页面跳转
typedef NS_ENUM(NSInteger,InovationType) {
    
    kWisdomMerchant = 0,          //智慧招商
    kInovationAndBusiness,     //创新创业
    kIntellectualPropertyRight,  //知识产权
    kProjectShenbao,            //项目申报
    kTrainingService,          //培训服务
    kCollectMoneyService,      //融资服务
    kProjectRoadShow,         //项目路演
};



#ifdef DEBUG
# define YYLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define YYLog(...)
#endif

#define device_is_iphone_4 ([UIScreen instancesRespondToSelector:@selector(currentMode)]?CGSizeEqualToSize(CGSizeMake(640,960),[[UIScreen mainScreen] currentMode].size):NO)
#define device_is_iphone_5 ([UIScreen instancesRespondToSelector:@selector(currentMode)]?CGSizeEqualToSize(CGSizeMake(640,1136),[[UIScreen mainScreen] currentMode].size):NO)
#define device_is_iphone_6 ([UIScreen instancesRespondToSelector:@selector(currentMode)]?CGSizeEqualToSize(CGSizeMake(750,1334),[[UIScreen mainScreen] currentMode].size):NO)
#define device_is_iphone_6p ([UIScreen instancesRespondToSelector:@selector(currentMode)]?CGSizeEqualToSize(CGSizeMake(1242,2208),[[UIScreen mainScreen] currentMode].size):NO)

#define  IS_iPhoneX (CGSizeEqualToSize(CGSizeMake(375.f, 812.f), [UIScreen mainScreen].bounds.size) || CGSizeEqualToSize(CGSizeMake(812.f, 375.f), [UIScreen mainScreen].bounds.size)  || CGSizeEqualToSize(CGSizeMake(414.f, 896.f), [UIScreen mainScreen].bounds.size) || CGSizeEqualToSize(CGSizeMake(896.f, 414.f), [UIScreen mainScreen].bounds.size))


//判断iPhoneXs Max
#define SCREENSIZE_IS_XS_MAX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !UI_IS_IPAD : NO)

#define IS_IPhoneX_All ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.height == 896)

///适配 X
#define ScreenHeightFlex (ScreenHeight>736?122:64)

#define ScreenHeight [UIScreen mainScreen].bounds.size.height
#define ScreenWidth  [UIScreen mainScreen].bounds.size.width
#define kNavHeight 64
#define kTabHeight 49
#define kpopViewHeight 345

//*************************************
//加上了iphonex 判断  底部标签栏高度
#define TabBarHeight (IS_iPhoneX ? (49.f+34.f) : 49.f)
//状态栏高度
#define StatusBarHeight (IS_iPhoneX ? 44.f : 20.f)
//导航栏高度
#define NavBarHeight (44.f+StatusBarHeight)


#define IOS7 [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0
#define iOS8OrLater ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
#define iOS9OrLater ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define iOS10OrLater ([UIDevice currentDevice].systemVersion.floatValue >= 10.0f)

////整体用的底色  特别浅的灰色
#define kBackgroundColor [UIColor colorWithRed:242.f/255.f green:242.f/255.f blue:242.f/255.f alpha:1]


#define kNavigationBarGrayColor WDColorFrom16RGB(0xF9F8F8)
#define kNavigationTitleColor kWhiteColor
#define kBackBlue NColorFrom16RGB(0x23b7e5)

//应用的名称
#define app_Name [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]


//获取rgb颜色
#define NColorRGB(a,b,c) [UIColor colorWithRed:a/255.0 green:b/255.0 blue:c/255.0 alpha:1.0]
//获取16进制颜色
#define NColorFrom16RGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
///NColorFrom16RGB(0x1fd989)  登录按钮绿色     #28affe
//0x5da7ff    1fd989
//NColorFrom16RGB(0x28affe)

///16进制转换
#define NNColorHex(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
///section 高度相关
#define SectionHeaderHeight  60.f

///主题蓝色
#define ThemeBlue NColorFrom16RGB(0x23b7e5)

//直接根据图片名称获取图片
#define WDImgName(name) [UIImage imageNamed:name]
#define NNImgName(name) [UIImage imageNamed:name]


#define kBlackColor      ([UIColor blackColor])
#define kLightGrayColor  [UIColor lightGrayColor]
#define kGrayColor  [UIColor grayColor]
#define kDarkGrayColor [UIColor darkGrayColor]

#define kMagentaColor   [UIColor magentaColor]
#define kbrownColor   [UIColor brownColor]

#define kWhiteColor  [UIColor whiteColor]
#define kClearColor  [UIColor clearColor]
#define kCyanColor  [UIColor cyanColor]
#define kFont8 [UIFont systemFontOfSize:8]
#define kFont9 [UIFont systemFontOfSize:9]
#define kFont10 [UIFont systemFontOfSize:10]
#define kFont12 [UIFont systemFontOfSize:12]
#define kFont13 [UIFont systemFontOfSize:13]
#define kFont14 [UIFont systemFontOfSize:14]
#define kFont15 [UIFont systemFontOfSize:15]
#define kFont16 [UIFont systemFontOfSize:16]
#define kFont18 [UIFont systemFontOfSize:18]
#define kBoldFont [UIFont boldSystemFontOfSize:15]

//block 循环引用避免
#define WeakStament(wself) __weak typeof(self) wself=self


//去除"-(id)performSelector:(SEL)aSelector withObject:(id)object;"的警告
#define SuppressPerformSelectorLeakWarning(Stuff) /do { /_Pragma("clang diagnostic push") /_Pragma("clang diagnostic ignored /"-Warc-performSelector-leaks/"") /Stuff; /_Pragma("clang diagnostic pop") /} while (0)

//获取rgb颜色
#define WDColorRGB(a,b,c) [UIColor colorWithRed:a/255.0 green:b/255.0 blue:c/255.0 alpha:1.0]
//获取16进制颜色
#define WDColorFrom16RGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

////蓝色
#define kSystemtBlue    [UIColor colorWithHex:@"32beff"]//该项目中使用的蓝色

#define kUserId @"userid"

#if TARGET_IPHONE_SIMULATOR
#define SIMULATOR 1
#elif TARGET_OS_IPHONE
#define SIMULATOR 0
#endif

#define fourIconHight  70.f
#define cycleHight  216.f
#define kCornerRadius 15.f

///每页请求的数量
#define kPageSize 30

#define kPushNoti  @"push"

#define  KEY_USERNAME_PASSWORD @"com.5dou.app.usernamepassword"
#define  KEY_USERNAME @"com.5dou.app.username"
#define  KEY_PASSWORD @"com.5dou.app.password"

#define kSaveUserInfoKey @"SaveUserInfoXiongAnKey"
#define LaunchKEY  @"firstlaunch"
#define kUserType  @"UserType"
#define kRefreshNotification @"refresh"

#define kWXAppID    @"wxaa44b1dbd49b1038"
#define kWXAppSecret @"79c63765e6d4e012174f5194f96ad760"

////qq 的称呼是key 不是secret

//QQ这快的还没有换 需要替换到
#define kQQAppId  @"1107468452"    //转成16进制后  4202a0a4
#define kQQAppKey @"wZqSWBHLa7GYLZHj"

///设备id
#define kDeviceToken @"uuyjilejfas8987"


///微信登录用户信息返回后的通知 为了调用自己服务器的登录接口
#define kWXLoginNoti @"kWXLoginGetUserInfoNoti"

/**
 屏幕宽
 */
#define  TW_ScreenWidth   [UIScreen mainScreen].bounds.size.width

/**
 屏幕高
 */
#define  TW_ScreenHeight  [UIScreen mainScreen].bounds.size.height

/**
 是否IiPhone X
 */
#define IPHONE_X \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

//状态栏高度
#define  TW_StatusBarHeight      (IPHONE_X ? 44.f : 20.f)
//导航栏高度
#define  TW_NavigationBarHeight  44.f


/**
 状态栏加导航栏高度
 */
#define  TW_StatusBarAndNavigationBarHeight  (IPHONE_X ? 88.f : 64.f)

/**
 设置安全区
 */
#define TW_ViewSafeAreInsets(view) ({UIEdgeInsets insets; if(@available(iOS 11.0, *)) {insets = view.safeAreaInsets;} else {insets = UIEdgeInsetsZero;} insets;})

/**
 TabBar高度,以及tabbar安全区
 */
#define  TW_TabbarHeight         (IPHONE_X ? (49.f+34.f) : 49.f)
#define  TW_TabbarSafeBottomMargin         (IPHONE_X ? 34.f : 0.f)

/**
 获取StoryBoard Controller
 */
#define MainStoryBoard [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]

/**
 获取WIndows
 */
#define KWINDOWS [UIApplication sharedApplication].keyWindow

/**
 WeakSelf StrongSelf
 */
#define WeakSelf(type)  __weak typeof(type) weak##type = type;
#define StrongSelf(type) __strong __typeof__(type) strongSelf = type;

/**
 NSStringFormat
 */
#define NSStringFormat(format,...) [NSString stringWithFormat:format,##__VA_ARGS__]

/**
 主题颜色以及RGB
 */
#define MainColor  [UIColor colorWithRed:44/255.0 green:180/255.0 blue:121/255.0 alpha:1.0]
#define MainTextColor  [UIColor colorWithRed:60/255.0 green:59/255.0 blue:65/255.0 alpha:1.0]
#define MainWainColor  [UIColor colorWithRed:226/255.0 green:117/255.0 blue:106/255.0 alpha:1.0]
#define rgba(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]

//不同屏幕尺寸适配（375,667是因为效果图为iPhone6plus如果不是则根据实际情况修改）
#define xxWidthRatio  (TW_ScreenWidth / 375.0)
#define xxHeightRatio (TW_ScreenHeight / 667.0)
#define xxAdaWidth(x)  ceilf((x) * xxWidthRatio)
#define xxAdaHeight(x) ceilf((x) * xxHeightRatio)


#endif /* DEFINE_h */
